# 顶层Makefile

# 将所有的头文件生成一个头文件目录
# 将所有的源文件(BenchMark除外)打包成动静态库
.PHONY:output
output:Header Lib32 Lib64
Header:
	@mkdir Header;\
	cp Src/Comm/Comm.h Header;\
	cp Src/ObjectPool/ObjectPool.h Header;\
	cp Src/PageCache/PageCache.h Header;\
	cp Src/CentralCache/CentralCache.h Header;\
	cp Src/ThreadCache/ThreadCache.h Header;\
	cp Src/ConcurrentAlloc/ConcurrentAlloc.h Header

Lib32:a32 so32
a32:
	@mkdir StaticLib_32;\
	g++ -c Src/ThreadCache/ThreadCache.cpp Src/CentralCache/CentralCache.cpp Src/PageCache/PageCache.cpp Src/ObjectPool/ObjectPool.cpp -std=c++17 -m32;\
	ar -rc StaticLib_32/libMyTcMalloc.a *.o;\
	rm -rf *.o
so32:
	@mkdir DynamicLib_32;\
	g++ -c -fPIC Src/ThreadCache/ThreadCache.cpp Src/CentralCache/CentralCache.cpp Src/PageCache/PageCache.cpp Src/ObjectPool/ObjectPool.cpp -std=c++17 -m32;\
	g++ -shared -o DynamicLib_32/libMyTcMalloc.so *.o -m32;\
	rm -rf *.o

Lib64:a64 so64
a64:
	@mkdir StaticLib_64;\
	g++ -c Src/ThreadCache/ThreadCache.cpp Src/CentralCache/CentralCache.cpp Src/PageCache/PageCache.cpp Src/ObjectPool/ObjectPool.cpp -std=c++17;\
	ar -rc StaticLib_64/libMyTcMalloc.a *.o;\
	rm -rf *.o
so64:
	@mkdir DynamicLib_64;\
	g++ -c -fPIC Src/ThreadCache/ThreadCache.cpp Src/CentralCache/CentralCache.cpp Src/PageCache/PageCache.cpp Src/ObjectPool/ObjectPool.cpp -std=c++17;\
	g++ -shared -o DynamicLib_64/libMyTcMalloc.so *.o;\
	rm -rf *.o

.PHONY:clean
clean:
	@rm -rf Header;\
	rm -rf StaticLib_32;\
	rm -rf DynamicLib_32;\
	rm -rf StaticLib_64;\
	rm -rf DynamicLib_64;\


	
